package 蓝桥真题.javab组省赛历年真题.编程题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class 最少刷题数 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=100010;
       static int nums[]=new int[N],a[]=new int[N],n;
       public static void main(String[] ss) throws NumberFormatException, IOException {
		      n=Integer.parseInt(br.readLine());
		      ss=br.readLine().split(" ");
		      for(int i=0;i<n;i++){
		    	  nums[i]=Integer.parseInt(ss[i]);
		    	  a[i]=nums[i];
		      }
		      Arrays.sort(a,0,n);
		      int mid=0;
		      if(n%2==0)mid=n/2-1;
		      else mid=n/2;
		      //二分查找
		      int find=0;
		      boolean flag = false;
		      for(int i=mid;i<n;i++){
		    	  int l=0,r=n-1;
		    	  while(l<r){
		    		  mid=l+r>>1;
		    	      if(a[mid]>=a[i])
		    	    	  r=mid;
		    	      else l=mid+1;
		    	  }
		    	  int lnumbers=l-0;
		    	  l=0;r=n-1;
		    	  while(l<r){
		    		  mid=l+r+1>>1;
		    	      if(a[mid]<=a[i])
		    	    	  l=mid;
		    	      else r=mid-1;
		    	  }
		    	  int rnumbers=(n-l-1);
		    	  if(lnumbers>=rnumbers){
		    		  find=a[l];
		    		  if(lnumbers==rnumbers)
		    			  flag=true;
		    		  break;
		    	  }
		    	  i=rnumbers;
		      }
		      for(int i=0;i<n;i++){
		    	  if(nums[i]<find){
		    		  if(flag)
		    			 System.out.print(find-nums[i]+1+" ");
		    		  else 
		    			 System.out.print(find-nums[i]+" ");
		    	  }else
		    		  System.out.print(0+" ");
		    	  
		      }
	}
}
